
<?php
//模块插件类
//插件功能类，由系统调用，实现具体功能。
defined('BY_JYA') or exit('error');
class core_jy_cmso2o extends plugin{
	public function appcode($path,$appid,$secret){
		//$path='/'.$plugin.'/'.$action.'/index';
		$u='https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$appid.'&secret='.$secret;
		$re=cfc('http')->ihttp_get($u);
		$re=json_decode($re['content'],true);
		$access_token=$re['access_token'];
		$url='https://api.weixin.qq.com/wxa/getwxacode?access_token='.$access_token;
		//$url='https://api.weixin.qq.com/wxa/getwxacode?access_token={access_token}';
		$post=array('path'=>$path,'auto_color'=>true,'width'=>340);
		$post=ijson_encode($post);
		$result=cfc('http')->ihttp_post($url,$post);
		
		return $result['content'];

	}
}
?>
